from django.urls import path, re_path
from django.conf.urls.static import static
from .views import *


app_name = GeneralConfig.name
urlpatterns = [
    re_path(r'^$', home_overview, name='home'),
    # 订单
    re_path(r'^order_list/$', OrderListView.as_view(), name='order_list'),
    re_path(r'^order_list_success/$', OrderSuccessListView.as_view(), name='order_list_success'),
    # 订单详情
    re_path(r'^order/(?P<pk>\d+)/$', OrderDetailView.as_view(), name='order_detail'),
    re_path(r'^order_update/(?P<pk>\d+)/$', OrderUpdate.as_view(), name='order_update'),
    re_path(r'^order_file_update/(?P<pk>\d+)/$', OrderFileUpdate.as_view(), name='order_file_update'),
    re_path(r'^order_editor_update/(?P<pk>\d+)/$', OrderEditorUpdate.as_view(), name='order_editor_update'),
    re_path(r'^order_create/$', OrderCreate.as_view(), name='order_create'),
    path('order_quotation/<slug:order_public_access_key>/<int:pk>/',
         public_order_quotation, name='public_order_quotation'),
    path('order/<slug:order_public_access_key>/<int:pk>/',
         public_order_quotation_old, name='public_order_quotation_old'),
    path('order_quotation_en/<slug:order_public_access_key>/<int:pk>/',
         public_order_quotation_en, name='public_order_quotation_en'),
    path('order_production/<slug:order_public_access_key>/<int:pk>/production_list/',
         order_production_list, name='order_production_list'),
    re_path(r'^order_contract_cn/(?P<pk>\d+)/$', order_contract_cn, name='order_contract_cn'),
    re_path(r'^order_contract_en/(?P<pk>\d+)/$', order_contract_en, name='order_contract_en'),
    re_path(r'^order_invoice_en/(?P<pk>\d+)/$', order_invoice_en, name='order_invoice_en'),
    re_path(r'^order_add_item/(?P<pk>\d+)/$', add_order_items, name='order_add_item'),
    re_path(r'^order_update_item/(?P<pk>\d+)/$', ItemListUpdate.as_view(), name='order_item_update'),
    re_path(r'^item_note_update/(?P<pk>\d+)/$', ItemListNoteUpdate.as_view(), name='item_note_update'),
    re_path(r'^order_item_delete/(?P<pk>\d+)/$', delete_order_item, name='order_item_delete'),
    re_path(r'order_confirm/(?P<pk>\d+)/$', order_confirm, name='order_confirm'),
    # 设备
    re_path(r'^equipment_all_ls/$', EquipmentAllListView.as_view(), name='equipment_all_list'),
    re_path(r'^equipment_ls/$', equipment_ls, name='equipment_list'),
    re_path(r'^equipment_p_ls/$', equipment_p_ls, name='equipment_parts_list'),
    re_path(r'^equipment/(?P<pk>\d+)/$', EquipmentDetailView.as_view(), name='equipment_detail'),
    re_path(r'^equipment_p/(?P<pk>\d+)/$', EquipmentDetailPublicView.as_view(), name='equipment_detail_public'),
    re_path(r'^equipment_price_update/(?P<pk>\d+)/$', EquipmentPriceUpdate.as_view(), name='equipment_price_update'),
    re_path(r'^equipment_update/(?P<pk>\d+)/$', EquipmentUpdate.as_view(), name='equipment_update'),
    re_path(r'^equipment_create/$', EquipmentCreate.as_view(), name='equipment_create'),
    re_path(r'^equipment_copy/(?P<pk>\d+)/$', EquipmentCopy.as_view(), name='equipment_copy'),
    # 设备列表
    re_path(r'^batch_equipment_list/$', EquipmentListListView.as_view(), name='batch_equipment_list'),
    re_path(r'^create_batch_equipment_list/$', create_batch_equipment_list, name='create_batch_equipment_list'),
    re_path(r'^equipment_list_update/(?P<pk>\d+)/$', EquipmentListUpdate.as_view(), name='equipment_list_update'),
    re_path(r'^batch_add_order_items/(?P<order_id>\d+)/$', batch_add_order_items, name='batch_add_order_items'),
    # 设备组装
    re_path(r'^equipment_assembly_list/$', EquipmentAssemblyListView.as_view(), name='equipment_assembly_list'),
    re_path(r'^equipment_als_create/$', EquipmentAssemblyCreate.as_view(), name='equipment_als_create'),
    re_path(r'^equipment_als_update/(?P<pk>\d+)/$', EquipmentAssemblyUpdate.as_view(), name='equipment_als_update'),
    re_path(r'^equipment_als_detail/(?P<pk>\d+)/$', equipment_assembly_detail, name='equipment_assembly_detail'),
    # 设备组装采购
    re_path(r'^plan_assembly_list/$', PlanAssemblyListView.as_view(), name='plan_assembly_list'),
    re_path(r'^plan_assembly_create/$', PlanAssemblyCreate.as_view(), name='plan_assembly_create'),
    re_path(r'^plan_assembly_update/(?P<pk>\d+)/$', PlanAssemblyUpdate.as_view(),
            name='plan_assembly_update'),
    re_path(r'^plan_assembly_detail/(?P<pk>\d+)/$', plan_assembly_detail, name='plan_assembly_detail'),
    re_path(r'^plan_assembly_delete/(?P<pk>\d+)/$', plan_assembly_delete, name='plan_assembly_delete'),
    # 部件管理
    re_path(r'^assembly_item_create/$', AssemblyItemCreate.as_view(), name='assembly_item_create'),
    re_path(r'^assembly_item_update/(?P<pk>\d+)/$', AssemblyItemUpdate.as_view(), name='assembly_item_update'),
    re_path(r'^assembly_item_delete/(?P<pk>\d+)/$', assembly_item_delete, name='assembly_item_delete'),
    # 仓库
    re_path(r'^equipment_inventory/$', equipment_inventory, name='equipment_inventory'),
    re_path(r'^equipment_in/$', EquipmentInListView.as_view(), name='equipment_in_list'),
    re_path(r'^equipment_in_create/$', EquipmentInCreate.as_view(), name='equipment_in_create'),
    re_path(r'^equipment_in_update/(?P<pk>\d+)/$', EquipmentInUpdate.as_view(), name='equipment_in_update'),
    re_path(r'^equipment_out/$', EquipmentOutListView.as_view(), name='equipment_out_list'),
    re_path(r'^equipment_out_create/$', EquipmentOutCreate.as_view(), name='equipment_out_create'),
    re_path(r'^equipment_out_update/(?P<pk>\d+)/$', EquipmentOutUpdate.as_view(), name='equipment_out_update'),
    # 客户
    re_path(r'^client_list/$', ClientListView.as_view(), name='client_list'),
    re_path(r'^client/(?P<pk>\d+)/$', ClientDetailView.as_view(), name='client_detail'),
    re_path(r'^client_update/(?P<pk>\d+)/$', ClientUpdate.as_view(), name='client_update'),
    re_path(r'^client_create/$', ClientCreate.as_view(), name='client_create'),
    # 服务记录
    re_path(r'^service_record_list/$', ServiceRecordListView.as_view(), name='service_record_list'),
    re_path(r'^service_record_update/(?P<pk>\d+)/$', ServiceRecordUpdate.as_view(), name='service_record_update'),
    re_path(r'^service_record_create/$', ServiceRecordCreate.as_view(), name='service_record_create'),
    # 公告
    re_path(r'^announcement_create/$', AnnounceCreate.as_view(), name='announcement_create'),
    re_path(r'^announcement_update/(?P<pk>\d+)/$', AnnounceUpdate.as_view(), name='announcement_update'),
    # 资金流水
    re_path(r'^in_out_list/$', InOutListView.as_view(), name='in_out_list'),
    re_path(r'^in_out_create/$', InOutCreate.as_view(), name='add_inout'),
    re_path(r'^in_out_update/(?P<pk>\d+)/$', InOutUpdate.as_view(), name='change_inout'),
    re_path(r'^in_out_type_list/$', InOutTypeListView.as_view(), name='in_out_type_list'),
    re_path(r'^in_out_type_add/$', InOutTypeCreate.as_view(), name='add_inout_type'),
    re_path(r'^in_out_type_update/(?P<pk>\d+)/$', InOutTypeUpdate.as_view(), name='change_inout_type'),
    # 固定资产
    re_path(r'^fixed_assets_list/$', FixedAssetsListView.as_view(), name='fixed_assets_list'),
    re_path(r'^fixed_assets_create/$', FixedAssetsCreate.as_view(), name='add_fixed_assets'),
    re_path(r'^fixed_assets_update/(?P<pk>\d+)/$', FixedAssetsUpdate.as_view(), name='change_fixed_assets'),
    re_path(r'^fixed_assets_type_create/$', FixedAssetsTypeCreate.as_view(), name='add_fixed_assets_type'),
    re_path(r'^fixed_assets_type_update/(?P<pk>\d+)/$', FixedAssetsTypeUpdate.as_view(),
            name='change_fixed_assets_type'),
    # 固定资产入库
    re_path(r'^fixed_assets_in_list/$', FixedAssetsInListView.as_view(), name='fixed_assets_in_list'),
    re_path(r'^fixed_assets_in_create/$', FixedAssetsInCreate.as_view(), name='add_fixed_assets_in'),
    re_path(r'^fixed_assets_in_update/(?P<pk>\d+)/$', FixedAssetsInUpdate.as_view(), name='change_fixed_assets_in'),
    # 固定资产出库
    re_path(r'^fixed_assets_out_list/$', FixedAssetsOutListView.as_view(), name='fixed_assets_out_list'),
    re_path(r'^fixed_assets_out_create/$', FixedAssetsOutCreate.as_view(), name='add_fixed_assets_out'),
    re_path(r'^fixed_assets_out_update/(?P<pk>\d+)/$', FixedAssetsOutUpdate.as_view(), name='change_fixed_assets_out'),
    # 用户管理
    re_path(r'^change_password/$', password_change_own, name='change_password'),
    re_path(r'^user_action_list/$', user_action_list, name='user_action_list'),
    re_path(r'^users/$', create_s_user, name='user_list'),
    re_path(r'^groups/$', GroupCreate.as_view(), name='group_list'),
    re_path(r'^user_update/(?P<pk>\d+)/$', UserUpdate.as_view(), name='user_update'),
    re_path(r'^group_update/(?P<pk>\d+)/$', GroupUpdate.as_view(), name='group_update'),
    # 工具
    re_path(r'^eq_ls/$', eq_ls, name='eq_ls'),
    re_path(r'^ea_export/(?P<pk>\d+)/$', ea_export, name='ea_export'),
    re_path(r'^money_io_export/$', money_io_export, name='money_io_export'),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
